




/*
 Copyright(c)2010 PingAn Inc.
*/
(function(b,e){var g={dragStart:"start.draggable",drag:"drag.draggable",dragStop:"stop.draggable",maxHeight:"maxHeight.resizable",minHeight:"minHeight.resizable",maxWidth:"maxWidth.resizable",minWidth:"minWidth.resizable",resizeStart:"start.resizable",resize:"drag.resizable",resizeStop:"stop.resizable"};b.widget("ui.dialog",{options:{title:"",url:"",message:"",height:200,width:400,element:"",beforeclose:function(){},close:function(){},closeOnEscape:!0,modal:!0,resizable:!1,bgiframe:!0,draggable:!1,
position:"center",dialogClass:"pa_ui_dialog",closeText:"关闭",minimize:!1,minText:"最小化",maximize:!1,maxText:"最大化",autoOpen:!0,maxHeight:!1,maxWidth:!1,minHeight:5,minWidth:5,openMode:"absolute",frameOverlay:!1,stack:!0,hide:null,show:null,zIndex:1E3},_init:function(){this.originalTitle=this.element.attr("title");this.originPosition=null;var c=this,a=this.options,d=a.title||this.originalTitle||"",h=b.ui.dialog.getTitleId(this.element);this.uuid=b.ui.dialog.uuid++;var f=(this.uiDialog=b("<div/>")).appendTo(document.body).hide().addClass(a.dialogClass).css({position:a.openMode,
overflow:"hidden",zIndex:a.zIndex}).attr("tabIndex",-1).css("outline",0).keydown(function(d){a.closeOnEscape&&d.keyCode&&d.keyCode==b.ui.keyCode.ESCAPE&&c.close(d)}).attr({role:"dialog","aria-labelledby":h}).mousedown(function(a){c.moveToTop(!0,a)});this.uiDialogContent=this.element.show().removeAttr("title").addClass("pa_ui_dialog_content").appendTo(f);var e=(this.uiDialogTitlebar=b("<div></div>")).addClass("pa_ui_dialog_titlebar").prependTo(f),g=b("<div></div>").addClass("pa_ui_dialog_titlebar_button").prependTo(e),
k=b('<a href=""/>').addClass("pa_ui_dialog_titlebar_close").attr("title",a.closeText).attr("role","button").mousedown(function(a){a.stopPropagation()}).click(function(a){c.close(a);return!1}),j=b('<a href=""/>').addClass("pa_ui_dialog_titlebar_min").attr("role","button").attr("title",a.minText).mousedown(function(a){a.stopPropagation()}).click(function(){return c.min()}),i=b('<a href=""/>').addClass("pa_ui_dialog_titlebar_max").attr("role","button").attr("title",a.maxText).mousedown(function(a){a.stopPropagation()}).click(function(){return c.max()});
b("<div></div>").addClass("pa_ui_dialog_title").attr("id",h).html('<div class="pa_ui_dialog_title_left"><div class="pa_ui_dialog_title_right">'+d+"</div></div>").prependTo(e);a.minimize&&j.appendTo(g);a.maximize&&i.appendTo(g);k.appendTo(g);b("<div></div>").addClass("pa_ui_dialog_footer").html('<div class="footer_left"></div><div class="footer_right"></div>').appendTo(f);e.find("*").add(e).disableSelection();this._isOpen=!1;a.draggable||a.resizable||a.bgiframe?(d=[],a.draggable&&!a.resizable&&!b.fn.draggable&&
d.push("draggable"),a.resizable&&!b.fn.resizable&&d.push("resizable"),a.bgiframe&&!b.fn.bgiframe&&d.push("bgiframe"),0<d.length?b.paui.use(d,function(){a.draggable&&b.fn.draggable&&c._makeDraggable();a.resizable&&b.fn.resizable&&c._makeResizable();a.bgiframe&&b.fn.bgiframe&&f.bgiframe();a.autoOpen&&c.open()}):(a.draggable&&b.fn.draggable&&c._makeDraggable(),a.resizable&&b.fn.resizable&&c._makeResizable(),a.bgiframe&&b.fn.bgiframe&&f.bgiframe(),a.autoOpen&&c.open())):a.autoOpen&&c.open()},destroy:function(){this.overlay&&
this.overlay.destroy.call(this);this.uiDialog.hide();this.element.unbind(".dialog").removeData("dialog").removeClass("pa_ui_dialog_content").hide().appendTo("body");!this.options.element&&this.element.empty();this.uiDialog.remove();this.originalTitle&&this.element.attr("title",this.originalTitle)},isOpen:function(){return this._isOpen},open:function(){if(!this._isOpen){var c=this.options,a=this.uiDialog;this.overlay=c.modal?new b.ui.dialog.overlay(this):null;c.frameOverlay&&this._frameOverlay(!0);
a.next().length&&a.appendTo("body");this._size();this._position(c.position);a.show(c.show);""==a.find(".pa_ui_dialog_title_right").html()&&setTimeout(function(){try{var c=a.find("iframe"),h;1==c.length&&(h=c[0].contentWindow.document);2==c.length&&(h=c[1].contentWindow.document);h&&b(h).ready(function(){h.title?a.find(".pa_ui_dialog_title_right").html(h.title):a.find(".pa_ui_dialog_title_right").html(document.title)})}catch(e){}},800);this.moveToTop(!0);c.modal&&a.bind("keypress.dialog",function(a){if(a.keyCode==
b.ui.keyCode.TAB){var c=b(":tabbable",this),e=c.filter(":first")[0],g=c.filter(":last")[0];a.target==g&&!a.shiftKey?setTimeout(function(){e.focus()},1):a.target==e&&a.shiftKey&&setTimeout(function(){g.focus()},1)}});b([]).add(a.find(".pa_ui_dialog_content :tabbable:first")).add(a.find(".pa_ui_dialog_buttonpane :tabbable:first")).add(a).filter(":first").focus();this._trigger("open");this._isOpen=!0;b.ui.dialog.dialogs.push(this.element);this.options.modal&&b.ui.dialog.modalDialogs.push(this.element);
b.ui.dialog.currentDialog=this.element}},moveToTop:function(c,a){if(this.options.modal&&!c||!this.options.stack&&!this.options.modal)return this._trigger("focus",a);this.options.zIndex>b.ui.dialog.maxZ&&(b.ui.dialog.maxZ=this.options.zIndex);this.overlay&&this.overlay.$el.css("z-index",1E3);var d={scrollTop:this.element.attr("scrollTop"),scrollLeft:this.element.attr("scrollLeft")};this.uiDialog.css("z-index",++b.ui.dialog.maxZ);this.element.attr(d);this._trigger("focus",a);b.ui.dialog.currentDialog=
this.element},min:function(){if(this.uiDialog.hasClass(this.options.dialogClass)){this.uiDialog.removeClass(this.options.dialogClass).addClass(this.options.dialogClass+"_min");this.uiDialog.css("height","auto");this.uiDialogContent.hide();this.originPosition=this.uiDialog.position();b.ui.dialog.minDialogs.push(this.element);for(var c=0,a=b(window).height()-this.uiDialogTitlebar.outerHeight(),d=0;d<b.ui.dialog.minDialogs.length;d++)if(b.ui.dialog.minDialogs[d]!=this.element){var h=b.ui.dialog.minDialogs[d].dialog("getPosition")[0];
b.ui.dialog.minDialogs[d].dialog("getPosition");var e=b.ui.dialog.minDialogs[d].dialog("getDimension")[0];c==h&&(c+=e)}this.uiDialog.css("left",c).css("top",a).css("bottom","3px")}else if(this.uiDialog.hasClass(this.options.dialogClass+"_min")){this.uiDialog.css("height",this.options.height);this.uiDialog.removeClass(this.options.dialogClass+"_min").addClass(this.options.dialogClass);this.uiDialogContent.show();this.uiDialog.css("left",this.originPosition.left).css("top",this.originPosition.top);
for(d=0;d<b.ui.dialog.minDialogs.length;d++)if(b.ui.dialog.minDialogs[d]==this.element){b.ui.dialog.minDialogs.splice(d,1);break}}return!1},max:function(){if(this.uiDialog.hasClass(this.options.dialogClass)){this.uiDialog.removeClass(this.options.dialogClass).addClass(this.options.dialogClass+"_max");this.originPosition=this.uiDialog.position();this.originDimensions=this.getDimension();var c=document.documentElement.clientWidth+b(document).scrollLeft(),a=document.documentElement.clientHeight+b(document).scrollTop();
this.uiDialog.css("left","0").css("top","0").css("width",c).css("height",a);this.uiDialogContent.css("height",this.uiDialog.innerHeight()-this.uiDialogTitlebar.outerHeight()-10);b("iframe[role=iframe]",this.uiDialogContent).css("height",this.element.css("height"))}else this.uiDialog.hasClass(this.options.dialogClass+"_max")&&(this.uiDialog.removeClass(this.options.dialogClass+"_max").addClass(this.options.dialogClass),this.uiDialog.css("left",this.originPosition.left).css("top",this.originPosition.top).css("width",
this.originDimensions[0]).css("height",this.originDimensions[1]),this.uiDialogContent.css("height",this.originDimensions[3]-10),b("iframe[role=iframe]",this.uiDialogContent).css("height",this.element.css("height")));return!1},close:function(c){var a=this;if(!1!==a._trigger("beforeclose",c)){for(var d=0;d<b.ui.dialog.dialogs.length;d++)if(b.ui.dialog.dialogs[d]==this.element){b.ui.dialog.dialogs.splice(d,1);break}for(d=0;d<b.ui.dialog.modalDialogs.length;d++)if(b.ui.dialog.modalDialogs[d]==this.element){b.ui.dialog.modalDialogs.splice(d,
1);break}for(d=0;d<b.ui.dialog.minDialogs.length;d++)if(b.ui.dialog.minDialogs[d]==a.element){b.ui.dialog.minDialogs.splice(d,1);break}b.ui.dialog.currentDialog=b.ui.dialog.dialogs&&b.ui.dialog.dialogs.length?b.ui.dialog.dialogs[b.ui.dialog.dialogs.length-1]:null;a.overlay&&a.overlay.destroy.call(a);a.options.frameOverlay&&this._frameOverlay(!1);a.uiDialog.unbind("keypress.dialog");a.options.hide?a.uiDialog.hide(a.options.hide,function(){a._trigger("close",c)}):a.uiDialog.hide()&&a._trigger("close",
c);b.ui.dialog.overlay.resize();a._isOpen=!1;this.destroy()}},getDimension:function(){return[this.uiDialog.outerWidth(),this.uiDialog.outerHeight(),this.uiDialogContent.outerWidth(),this.uiDialogContent.outerHeight()]},getPosition:function(){return[this.uiDialog.offset().left,this.uiDialog.offset().top]},_makeDraggable:function(){var c=this,a=this.options,d;this.uiDialog.draggable({cancel:".pa_ui_dialog_content",handle:".pa_ui_dialog_titlebar",containment:"document",start:function(){d=a.height;b(this).height(b(this).height()).addClass("pa_ui_dialog_dragging");
a.dragStart&&a.dragStart.apply(c.element[0],arguments)},drag:function(){a.drag&&a.drag.apply(c.element[0],arguments)},stop:function(){c.uiDialog.is("."+c.options.dialogClass+"_min")&&(d=c.uiDialog.height);b(this).removeClass("pa_ui_dialog_dragging").height(d);a.dragStop&&a.dragStop.apply(c.element[0],arguments);b.ui.dialog.overlay.resize()}})},_makeResizable:function(c){var c=c===e?this.options.resizable:c,a=this,d=this.options;this.uiDialog.resizable({cancel:".pa_ui_dialog_content",alsoResize:this.element,
maxWidth:d.maxWidth,maxHeight:d.maxHeight,minWidth:d.minWidth,minHeight:d.minHeight,start:function(){b(this).addClass("pa_ui_dialog_resizing");d.resizeStart&&d.resizeStart.apply(a.element[0],arguments)},resize:function(){d.resize&&d.resize.apply(a.element[0],arguments)},handles:"string"==typeof c?c:"n,e,s,w,se,sw,ne,nw",stop:function(){b(this).removeClass("pa_ui_dialog_resizing");d.height=b(this).height();d.width=b(this).width();d.resizeStop&&d.resizeStop.apply(a.element[0],arguments);b.ui.dialog.overlay.resize()}})},
_position:function(c){var a=b(window),d=b(document),e=d.scrollTop(),d=d.scrollLeft();0<=b.inArray(c,["center","top","right","bottom","left"])&&(c=["right"==c||"left"==c?c:"center","top"==c||"bottom"==c?c:"middle"]);c.constructor!=Array&&(c=["center","middle"]);if(c[0].constructor==Number)d+=c[0];else switch(c[0]){case "left":d+=0;break;case "right":d+=a.width()-this.uiDialog.outerWidth();break;default:case "center":d+=(a.width()-this.uiDialog.outerWidth())/2}if(c[1].constructor==Number)e+=c[1];else switch(c[1]){case "top":e+=
0;break;case "bottom":e+=a.height()-this.uiDialog.outerHeight();break;default:case "middle":e="fixed"==this.options.openMode?(a.height()-this.uiDialog.outerHeight())/2:e+(a.height()-this.uiDialog.outerHeight())/2}if(b.ui.dialog.dialogs)for(c=0;c<b.ui.dialog.dialogs.length;c++)e+=20,d+=20;this.uiDialog.css({top:Math.max(e,0),left:Math.max(d,0)})},_setData:function(c,a){g[c]&&this.uiDialog.data(g[c],a);switch(c){case "closeText":this.uiDialogTitlebarCloseText.text(a);break;case "minText":this.uiDialogTitlebarMinText.text(a);
break;case "maxText":this.uiDialogTitlebarMaxText.text(a);break;case "dialogClass":this.uiDialog.removeClass(this.options.dialogClass).addClass(a);break;case "draggable":a?this._makeDraggable():this.uiDialog.draggable("destroy");break;case "height":this.uiDialog.height(a);break;case "position":this._position(a);break;case "resizable":var d=this.uiDialog,e=this.uiDialog.is(":data(resizable)");e&&!a&&d.resizable("destroy");e&&"string"==typeof a&&d.resizable("option","handles",a);e||this._makeResizable(a);
break;case "title":b(".pa_ui_dialog_title",this.uiDialogTitlebar).html(a||"&nbsp;");break;case "width":this.uiDialog.width(a)}b.widget.prototype._setData.apply(this,arguments)},_size:function(){var c=this.options,a=this;this.element.css({height:0,minHeight:0,width:"auto"});b("iframe[role=iframe]",this.uiDialogContent).css("height","0");var d=this.uiDialog.css({height:"auto",width:c.width}).height();this.element.css({minHeight:Math.max(c.minHeight-d,0),height:"auto"==c.height?"auto":Math.max(c.height-
d,0)});b("iframe[role=iframe]",this.uiDialogContent).css("height",this.element.css("height"));var e=!1,f=b("iframe[role=iframe]",this.uiDialogContent);try{if(f&&f[0]){var g=parseInt(a.uiDialogContent.css("padding-left").replace("px",""),10)+parseInt(a.uiDialogContent.css("padding-right").replace("pax",""),10),l=parseInt(a.uiDialogContent.css("padding-top").replace("px",""),10)+parseInt(a.uiDialogContent.css("padding-bottom").replace("pax",""),10);f.bind("load",function(){var j=w1=w2=0;try{f[0].contentDocument&&
f[0].contentDocument.body.offsetWidth?w1=f[0].contentDocument.body.offsetWidth+16:f[0].Document&&f[0].Document.body.scrollWidth&&(w2=f[0].Document.body.scrollWidth);var j=Math.max(w1,w2)+20,i=h1=h2=0;f[0].contentDocument&&f[0].contentDocument.body.offsetHeight?h1=f[0].contentDocument.body.offsetHeight+16:f[0].Document&&f[0].Document.body.scrollHeight&&(h2=Math.max(i,f[0].Document.body.scrollHeight));i=Math.max(h1,h2)+20;j>c.minWidth&&"undefined"==typeof c.width&&(e=!0,a.element.css("width",j),a.uiDialog.css("width",
j+g));i>c.minHeight&&"auto"==c.height&&(e=!0,a.element.css("height",i),a.uiDialog.css("height",i+l+d),b("iframe[role=iframe]",this.uiDialogContent).css("height",a.element.css("height")));e&&(a._position(c.position),b(window).trigger("resize"))}catch(k){}})}}catch(k){}},_frameOverlay:function(c){this.otherFrames||(this.otherFrames=this._allFrames());if(this.options.frameOverlay)if(c)for(c=0;c<this.otherFrames.length;c++){var a=this.otherFrames[c];a.$&&a.$.ui&&a.$.ui.dialog.overlay(null)}else for(c=
0;c<this.otherFrames.length;c++)a=this.otherFrames[c],0==b.ui.dialog.modalDialogs.length&&a.$&&a.$.ui&&a.$.ui.dialog&&a.$.ui.dialog.overlay.destroy(this)},_allFrames:function(){var b=[];if(top.frames&&0<top.frames.length)for(var a=0;a<top.frames.length;a++){var d=top.frames[a],e;try{e=top.frames[a].document.getElementsByTagName("frame")}catch(f){continue}if(0>=e.length)b.push(d);else for(var g=0;g<e.length;g++)b.push(d.frames[g])}return b}});b.extend(b.ui.dialog,{getter:"isOpen getDimension getPosition",
uuid:0,maxZ:0,getTitleId:function(b){return"pa_ui_dialog_title_"+(b.attr("id")||++this.uuid)},overlay:function(c){this.$el=b.ui.dialog.overlay.create(c)},dialogs:[],minDialogs:[],modalDialogs:[],currentDialog:null});b.extend(b.ui.dialog.overlay,{instance:null,dialogInstances:[],maxZ:0,events:b.map("focus,mousedown,mouseup,keydown,keypress,click".split(","),function(b){return b+".dialog_overlay"}).join(" "),create:function(c){null==this.instance?(b(document).bind("keydown.dialog_overlay",function(a){c.options.closeOnEscape&&
a.keyCode&&a.keyCode==b.ui.keyCode.ESCAPE&&c.close(a)}),b(window).bind("resize.dialog_overlay",b.ui.dialog.overlay.resize),$el=b("<div></div>").appendTo(document.body).addClass("pa_ui_dialog_overlay").css({width:this.width(),height:document.documentElement.clientHeight}),b.fn.bgiframe&&$el.bgiframe(),this.instance=$el):$el=this.instance;c&&this.dialogInstances.push(c.uuid);return this.instance},destroy:function(c){if(this.dialogInstances)for(var a=0;a<this.dialogInstances.length;a++)if(this.dialogInstances[a]==
c.uuid){this.dialogInstances.splice(a,1);break}if(this.dialogInstances&&0===this.dialogInstances.length&&this.instance||!this.dialogInstances&&this.instance)b([document,window]).unbind(".dialog_overlay"),this.instance.remove(),this.instance=null},height:function(){return document.documentElement.clientHeight},width:function(){if(b.browser.msie&&7>b.browser.version){var c=Math.max(document.documentElement.scrollWidth,document.body.scrollWidth),a=Math.max(document.documentElement.offsetWidth,document.body.offsetWidth);
return c<a?b(window).width()+"px":c+"px"}return b.browser.msie&&"8.0"==b.browser.version?document.documentElement.clientWidth<document.documentElement.offsetWidth-4?b(document).width()-21+"px":b(document).width()-4+"px":b(document).width()+"px"},resize:function(){b.ui.dialog.overlay.instance&&b.ui.dialog.overlay.instance.css({width:0,height:0}).css({width:b.ui.dialog.overlay.width(),height:b.ui.dialog.overlay.height()})}});b.extend(b.ui.dialog.overlay.prototype,{destroy:function(){b.ui.dialog.overlay.destroy(this)}})})(jQuery);
(function(b){b.paui.dialog={open:function(e){var g;if(e.url)g=e.iframeId&&e.iframeName?b("<div></div>").html('<iframe frameBorder="no" border="0" role="iframe" width="100%" allowTransparency="true" id="'+e.iframeId+'" name="'+e.iframeName+'" src="'+e.url+'"></iframe>').appendTo("body"):e.iframeName?b("<div></div>").html('<iframe frameBorder="no" border="0" role="iframe" width="100%" allowTransparency="true" name="'+e.iframeName+'" src="'+e.url+'"></iframe>').appendTo("body"):e.iframeId?b("<div></div>").html('<iframe frameBorder="no" border="0" role="iframe" width="100%" allowTransparency="true" id="'+
e.iframeId+'" src="'+e.url+'"></iframe>').appendTo("body"):b("<div></div>").html('<iframe frameBorder="no" border="0" role="iframe" width="100%" allowTransparency="true" src="'+e.url+'"></iframe>').appendTo("body");else if(e.message)g=b("<div></div>").html(e.message);else if(e.element)g=b("#"+e.element);else return null;e.autoOpen=!0;g.dialog(e);return g},close:function(e){(e=e||b.ui.dialog.currentDialog)&&e.dialog("close")}}})(jQuery);
(function(d,r){function A(a,c,b){return[parseInt(a[0],10)*(s.test(a[0])?c/100:1),parseInt(a[1],10)*(s.test(a[1])?b/100:1)]}function v(a,c){return parseInt(d.css(a,c),10)||0}d.ui=d.ui||{};var o,w=Math.max,m=Math.abs,B=Math.round,t=/left|center|right/,x=/top|center|bottom/,y=/[\+\-]\d+%?/,C=/^\w+/,s=/%$/,D=d.fn.position;d.position={scrollbarWidth:function(){if(o!==r)return o;var a,c,b=d("<div style='display:block;width:50px;height:50px;overflow:hidden;'><div style='height:100px;width:auto;'></div></div>");
c=b.children()[0];d("body").append(b);a=c.offsetWidth;b.css("overflow","scroll");c=c.offsetWidth;a===c&&(c=b[0].clientWidth);b.remove();return o=a-c},getScrollInfo:function(a){var c=a.isWindow?"":a.element.css("overflow-x"),b=a.isWindow?"":a.element.css("overflow-y"),b="scroll"===b||"auto"===b&&a.height<a.element[0].scrollHeight;return{width:"scroll"===c||"auto"===c&&a.width<a.element[0].scrollWidth?d.position.scrollbarWidth():0,height:b?d.position.scrollbarWidth():0}},getWithinInfo:function(a){var a=
d(a||window),c=d.isWindow(a[0]);return{element:a,isWindow:c,offset:a.offset()||{left:0,top:0},scrollLeft:a.scrollLeft(),scrollTop:a.scrollTop(),width:c?a.width():a.outerWidth(),height:c?a.height():a.outerHeight()}}};d.fn.position=function(a){if(!a||!a.of)return D.apply(this,arguments);var a=d.extend({},a),c,b,e,k,g,f=d(a.of),l=d.position.getWithinInfo(a.within),j=d.position.getScrollInfo(l),h=f[0],u=(a.collision||"flip").split(" "),o={};9===h.nodeType?(b=f.width(),e=f.height(),k={top:0,left:0}):d.isWindow(h)?
(b=f.width(),e=f.height(),k={top:f.scrollTop(),left:f.scrollLeft()}):h.preventDefault?(a.at="left top",b=e=0,k={top:h.pageY,left:h.pageX}):(b=f.outerWidth(),e=f.outerHeight(),k=f.offset());g=d.extend({},k);d.each(["my","at"],function(){var b=(a[this]||"").split(" "),c,e;b.length===1&&(b=t.test(b[0])?b.concat(["center"]):x.test(b[0])?["center"].concat(b):["center","center"]);b[0]=t.test(b[0])?b[0]:"center";b[1]=x.test(b[1])?b[1]:"center";c=y.exec(b[0]);e=y.exec(b[1]);o[this]=[c?c[0]:0,e?e[0]:0];a[this]=
[C.exec(b[0])[0],C.exec(b[1])[0]]});1===u.length&&(u[1]=u[0]);"right"===a.at[0]?g.left+=b:"center"===a.at[0]&&(g.left+=b/2);"bottom"===a.at[1]?g.top+=e:"center"===a.at[1]&&(g.top+=e/2);c=A(o.at,b,e);g.left+=c[0];g.top+=c[1];return this.each(function(){var h,r,n=d(this),p=n.outerWidth(),q=n.outerHeight(),s=v(this,"marginLeft"),t=v(this,"marginTop"),x=p+s+v(this,"marginRight")+j.width,y=q+t+v(this,"marginBottom")+j.height,i=d.extend({},g),z=A(o.my,n.outerWidth(),n.outerHeight());if(a.my[0]==="right")i.left=
i.left-p;else if(a.my[0]==="center")i.left=i.left-p/2;if(a.my[1]==="bottom")i.top=i.top-q;else if(a.my[1]==="center")i.top=i.top-q/2;i.left=i.left+z[0];i.top=i.top+z[1];if(!d.support.offsetFractions){i.left=B(i.left);i.top=B(i.top)}h={marginLeft:s,marginTop:t};d.each(["left","top"],function(f,k){if(d.ui.position[u[f]])d.ui.position[u[f]][k](i,{targetWidth:b,targetHeight:e,elemWidth:p,elemHeight:q,collisionPosition:h,collisionWidth:x,collisionHeight:y,offset:[c[0]+z[0],c[1]+z[1]],my:a.my,at:a.at,within:l,
elem:n})});d.fn.bgiframe&&n.bgiframe();a.using&&(r=function(c){var d=k.left-i.left,g=d+b-p,h=k.top-i.top,j=h+e-q,l={target:{element:f,left:k.left,top:k.top,width:b,height:e},element:{element:n,left:i.left,top:i.top,width:p,height:q},horizontal:g<0?"left":d>0?"right":"center",vertical:j<0?"top":h>0?"bottom":"middle"};if(b<p&&m(d+g)<b)l.horizontal="center";if(e<q&&m(h+j)<e)l.vertical="middle";l.important=w(m(d),m(g))>w(m(h),m(j))?"horizontal":"vertical";a.using.call(this,c,l)});n.offset(d.extend(i,
{using:r}))})};d.ui.position={fit:{left:function(a,c){var b=c.within,e=b.isWindow?b.scrollLeft:b.offset.left,d=b.width,g=a.left-c.collisionPosition.marginLeft,b=e-g,f=g+c.collisionWidth-d-e;c.collisionWidth>d?0<b&&0>=f?(e=a.left+b+c.collisionWidth-d-e,a.left+=b-e):a.left=0<f&&0>=b?e:b>f?e+d-c.collisionWidth:e:a.left=0<b?a.left+b:0<f?a.left-f:w(a.left-g,a.left)},top:function(a,c){var b=c.within,e=b.isWindow?b.scrollTop:b.offset.top,d=c.within.height,g=a.top-c.collisionPosition.marginTop,b=e-g,f=g+
c.collisionHeight-d-e;c.collisionHeight>d?0<b&&0>=f?(e=a.top+b+c.collisionHeight-d-e,a.top+=b-e):a.top=0<f&&0>=b?e:b>f?e+d-c.collisionHeight:e:a.top=0<b?a.top+b:0<f?a.top-f:w(a.top-g,a.top)}},flip:{left:function(a,c){var b=c.within,e=b.offset.left+b.scrollLeft,d=b.width,g=b.isWindow?0:b.offset.left,f=a.left-c.collisionPosition.marginLeft,b=f-g,l=f+c.collisionWidth-d-g,f="left"===c.my[0]?-c.elemWidth:"right"===c.my[0]?c.elemWidth:0,j="left"===c.at[0]?c.targetWidth:"right"===c.at[0]?-c.targetWidth:
0,h=-2*c.offset[0];if(0>b){if(e=a.left+f+j+h+c.collisionWidth-d-e,0>e||e<m(b))a.left+=f+j+h}else if(0<l&&(e=a.left-c.collisionPosition.marginLeft+f+j+h-g,0<e||m(e)<l))a.left+=f+j+h},top:function(a,c){var b=c.within,e=b.offset.top+b.scrollTop,d=b.height,g=b.isWindow?0:b.offset.top,f=a.top-c.collisionPosition.marginTop,b=f-g,l=f+c.collisionHeight-d-g,f="top"===c.my[1]?-c.elemHeight:"bottom"===c.my[1]?c.elemHeight:0,j="top"===c.at[1]?c.targetHeight:"bottom"===c.at[1]?-c.targetHeight:0,h=-2*c.offset[1];
if(0>b){if(e=a.top+f+j+h+c.collisionHeight-d-e,a.top+f+j+h>b&&(0>e||e<m(b)))a.top+=f+j+h}else if(0<l&&(e=a.top-c.collisionPosition.marginTop+f+j+h-g,a.top+f+j+h>l&&(0<e||m(e)<l)))a.top+=f+j+h}},flipfit:{left:function(){d.ui.position.flip.left.apply(this,arguments);d.ui.position.fit.left.apply(this,arguments)},top:function(){d.ui.position.flip.top.apply(this,arguments);d.ui.position.fit.top.apply(this,arguments)}}};(function(){var a,c,b,e,k=document.getElementsByTagName("body")[0];b=document.createElement("div");
a=document.createElement(k?"div":"body");c={visibility:"hidden",width:0,height:0,border:0,margin:0,background:"none"};k&&d.extend(c,{position:"absolute",left:"-1000px",top:"-1000px"});for(e in c)a.style[e]=c[e];a.appendChild(b);c=k||document.documentElement;c.insertBefore(a,c.firstChild);b.style.cssText="position: absolute; left: 10.7432222px;";b=d(b).offset().left;d.support.offsetFractions=10<b&&11>b;a.innerHTML="";c.removeChild(a)})();!1!==d.uiBackCompat&&function(a){var c=a.fn.position;a.fn.position=
function(b){if(!b||!b.offset)return c.call(this,b);var e=b.offset.split(" "),d=b.at.split(" ");1===e.length&&(e[1]=e[0]);/^\d/.test(e[0])&&(e[0]="+"+e[0]);/^\d/.test(e[1])&&(e[1]="+"+e[1]);1===d.length&&(/left|center|right/.test(d[0])?d[1]="center":(d[1]=d[0],d[0]="center"));return c.call(this,a.extend(b,{at:d[0]+e[0]+" "+d[1]+e[1],offset:r}))}}(jQuery)})(jQuery);
/*
 Copyright(c)2010 PingAn Inc.
*/
(function(b){b.widget("ui.popup",{_init:function(){var a=this;this.offset={top:0,left:0};this.container=b('<div class="pa_ui_popup_container"></div>').hide().css({position:"absolute"}).append(a.element.show()).bgiframe().appendTo("body");var d=document.documentElement.clientWidth+b(document).scrollLeft(),e=document.documentElement.clientHeight+b(document).scrollTop(),c=(d-a.container.outerWidth())/2,e=(e-a.container.outerHeight())/2;if(a.options.anchor&&a.options.anchor.id){var f="string"==typeof a.options.anchor.id?
b("#"+a.options.anchor.id):b(a.options.anchor.id),c=f.offset().left,e=f.offset().top+f.outerHeight(),g=a.container.outerWidth();g+c>d&&(c=c-g+f.outerWidth(),0>c&&(c=0))}this.offset.left=c;this.offset.top=e;a.container.css({left:c,top:e});a._isOpen=!1;d=this.options.triggerClose;"click"==d?b(document).bind("click."+a.widgetName,function(){}):"mouseout"==d&&a.container.bind("mouseout."+a.widgetName,function(){});b(window).bind("resize.popup",function(){a._resetPos()});return this}})})(jQuery);
/*
 Copyright(c)2010 PingAn Inc.
*/
(function(b){b.widget("ui.dropselect",{options:{canInput:!0,resizable:!1,currentOpen:null,autofill:!0,bgiframe:!1,trigger:2,customClass:"pa_ui_dropselect_custom",cssSelecting:"pa_ui_dropselect_selecting",cssItem:"pa_ui_dropselect_item",cssOptGroup:"pa_ui_dropselect_optgroup",cssSelectItem:"pa_ui_dropselect_item_select",setPos:{my:"left top",at:"left bottom",collision:"flip none",offset:"0 -1"},initCallback:""},_create:function(){this.element.is(":not(select)")||(this._build(),this._bind(),this.element.css("border",
0),this.element.hide())},_build:function(){var a=this,d=this.options;if(a.element.hasClass("pa_ui_dropselect_dropped"))return a;this.isShow=!1;this.selectValue=a.element.val();this.selectText=this._selectText(this.selectValue);this.otitleValue=a.element.attr("otitle");this.offsetSaved=a.element.offset();this.heightSaved=a.element.outerHeight();this.element.height();this.inputContainer=b('<span class="pa_ui_dropselect_input_Container"></span>');this.input=b('<input type="text" class="pa_ui_dropselect_input"/>').val(this.selectText);
this.options.canInput?this.input.attr("readonly","false").removeAttr("readonly"):this.input.attr("readonly","false");1==this.options.trigger&&this.input.bind("click",function(){b.ui.dropselect.currentOpen&&b.ui.dropselect.currentOpen!=a.element[0]&&b(b.ui.dropselect.currentOpen).dropselect("close")});2==this.options.trigger&&this.input.bind("click",function(b){a._trigger("drop",b,null);a.change();a._clickButton();d.searchable&&this.select()});this.button=b('<span class="pa_ui_dropselect_button"><b></b></span>').bind("click",
function(b){a._trigger("drop",b,null);a.change();a._clickButton()});""!==this.otitleValue&&(this.input.attr("otitle",this.otitleValue),this.button.attr("otitle",this.otitleValue));this.inputContainer.append(this.input);this.dropselect=b('<div class="pa_ui_dropselect"></div>').append(b('<div class="pa_ui_dropselect_inner paui-clearfix"></div>').append(this.inputContainer).append(this.button));this.popselect=b('<div class="pa_ui_dropselect_popup"></div>').hide().addClass(a.options.customClass).width(this.element.width()).append(this._getHtml());
this._buildPopup();a.element.after(this.popselect).after(this.dropselect).addClass("pa_ui_dropselect_dropped").bind("casselectchange",function(){a.input.val(a._selectText(a.element.val()))}).bind("propertychange",function(){a.input.val(a._selectText(a.element.val()))});a.dropselect.show();if(0!==a.element.outerWidth()){this.dropselect.width(a.element.outerWidth());var c=a.dropselect.children().css("borderLeftWidth"),f=a.dropselect.children().css("borderRightWidth"),e=a.dropselect.find("input").css("paddingLeft"),
e=e.replace("px",""),g=a.dropselect.find("input").css("paddingRight"),g=g.replace("px",""),c=c.replace("px",""),f=f.replace("px",""),h=a.dropselect.find("input").css("borderLeftWidth"),h=h.replace("px",""),i=a.dropselect.find("input").css("borderRightWidth"),i=i.replace("px",""),c=Number(c)+Number(f);this.input.width(a.element.outerWidth()-c-(Number(h)+Number(i))-a.button.outerWidth()-e-g);this.inputContainer.width(a.element.outerWidth()-c-a.button.outerWidth())}else 0!==this.element.css("width")&&
0!==this.button.css("width")&&(e=parseInt(this.element.css("width"),10),g=parseInt(this.button.css("width"),10),isNaN(e)||(this.dropselect.width(e),this.input.width(e-g),this.popselect.width(this.element.css("width"))));a.element[0].watch&&a.element[0].watch("value",function(b,c,d){a.element.val(d);a.element.attr("value",d);a.input.val(a._selectText(d))});a.element[0].watch&&a.element[0].watch("disabled",function(b,c,d){if(d){a.element.attr("disabled","");a.input.addClass("pa_ui_dropselect_disabled_input");
a.button.addClass("pa_ui_dropselect_disabled_button")}else{a.element.attr("disabled","true");a.input.removeClass("pa_ui_dropselect_disabled_input");a.button.removeClass("pa_ui_dropselect_disabled_button")}});a.options.searchable&&(a.liList=[],a.liList1=[],a.liList2=[],a._searchable());a.options.initCallback&&a.options.initCallback(a.dropselect,a.popselect)},_init:function(){},_bind:function(){var a=this;b(document).bind("keydown.dropselect",function(d){var c=b(a.popselect).css("display"),f="."+a.options.cssSelectItem,
e="";if("block"==c)if(window.event&&(d=window.event),c=d.charCode||d.keyCode,38==c)0<b(a.popselect).find(f).prev().size()&&(b(a.popselect).find(f).addClass(a.options.cssItem).removeClass(a.options.cssSelectItem).prev().addClass(a.options.cssSelectItem),e=b(a.popselect).find(f).attr("v"),a.input.val(a._selectText(e)),a.element.val(e),a.element.trigger("change"),a._trigger("select",d,null));else if(40==c)0<b(a.popselect).find(f).next().size()&&(b(a.popselect).find(f).addClass(a.options.cssItem).removeClass(a.options.cssSelectItem).next().addClass(a.options.cssSelectItem),
e=b(a.popselect).find(f).attr("v"),a.input.val(a._selectText(e)),a.element.val(e),a.element.trigger("change"),a._trigger("select",d,null));else if(13==c&&a.isShow)return e=b(a.popselect).find(f).attr("v"),a.input.val(a._selectText(e)),a.element.val(e),a.element.blur(),a.close(),a.element.trigger("change"),a._trigger("select",d,null),!1})},_clickExternal:function(a){a=b(a.target);!a.hasClass("pa_ui_dropselect_input")&&!a.hasClass("pa_ui_dropselect_button")&&!a.parent().hasClass("pa_ui_dropselect_button")&&
this.close()},_show:function(){b.ui.dropselect.currentOpen&&b.ui.dropselect.currentOpen!=this.element[0]&&b(b.ui.dropselect.currentOpen).dropselect("close");b.ui.dropselect.currentOpen=this.element[0];var a=this,d={of:this.dropselect};b.extend(d,a.options.setPos);this.popselect.show().position(d);this.isShow=!0;this.button.addClass(this.options.cssSelecting);this.input.addClass(this.options.cssSelecting);this.popselect.addClass(this.options.cssSelecting);var a=this,c=null;this.popselect.find("li").each(function(){b(this).attr("v")==
a.element.val()&&(c=this,b(this).addClass(a.options.cssSelectItem).removeClass(a.options.cssItem))});var a=this,d=a.popselect.find("ul").height(),f=a.popselect.height();d<f&&a.popselect.find(".pa_ui_dropselect_box").height(d).css("overflow","hidden");c&&(d=b(c).position().top,f=b(c).parent().parent().height(),d>f&&b(c).parent().parent().scrollTop(d))},_clickButton:function(){this.element.attr("disabled")||(this.isShow?this.close():this._show())},_selectText:function(a){var d=!1,c="";this.element.children("option").each(function(){!d&&
b(this).val()==a&&(b(this).attr("pa_ui_dropselect_selectable"),c=b(this).text(),d=!0)});return c.replace(/(^\s*)|(\s*$)/g,"")},_getHtml:function(){var a=this,d=this.element.children("option,optgroup"),c='<div class="pa_ui_dropselect_box">';0<d.length&&(c+='<ul class="">',b.each(d,function(){var d=b(this).attr("value"),e=b(this).attr("class")||" "+a.options.cssItem,g=b(this).text(),h=b(this).attr("pa_ui_dropselect_selectable");"OPTGROUP"==b(this)[0].tagName?(e=b(this).attr("class")||" "+a.options.cssOptGroup,
c+='<li t="'+g+'" v="'+d+'" class="'+e+'" pa_ui_dropselect_selectable="false"',b(this).attr("label")&&(c+='name="'+b(this).attr("name")+'"'),c+=">"+g+"</li>"):(c+='<li t="'+g+'" v="'+d+'" class="'+e+'"',h&&(c+=' pa_ui_dropselect_selectable="'+h+'"'),c+='><a href="javascript:void(0);" title="'+g+'" class="pa_ui_dropselect_item_link">'+g+"</a></li>")}),c+="</ul>");return c+="</div>"},_buildPopup:function(){var a=this;this.options.bgiframe&&this.iebgiframe();this.popselect.find("li").click(function(d){for(var c=
d.target;c!=this&&c.parentNode;)c=c.parentNode;"false"!==b(this).attr("pa_ui_dropselect_selectable")&&(c=b(c),a.input.val(c.text().replace(/(^\s*)|(\s*$)/g,"")),a.element.val(c.attr("v")),a.element.trigger("change"),a._trigger("select",d,null),a.element.blur(),a.close());return!1});b(document).bind("click.dropselect",function(b){a._clickExternal(b)});this.options.resizable&&b(".pa_ui_dropselect_box",this.popselect).resizable({handles:"s"})},setDisabled:function(a){"true"==a?(this.element.attr("disabled",
"true"),this.input.addClass("pa_ui_dropselect_disabled_input").attr("disabled","true"),this.button.addClass("pa_ui_dropselect_disabled_button").attr("disabled","true")):(this.element.removeAttr("disabled"),this.input.removeClass("pa_ui_dropselect_disabled_input").removeAttr("disabled"),this.button.removeClass("pa_ui_dropselect_disabled_button").removeAttr("disabled"))},setValue:function(a){this.input.val(this._selectText(a));this.element.val(a);this.element.attr("value",a)},change:function(){this.popselect.empty().addClass("pa_ui_dropselect_popup").width(this.input.closest(".pa_ui_dropselect_inner").outerWidth()).append(this._getHtml());
this._buildPopup();this.options.initCallback&&this.options.initCallback(this.dropselect,this.popselect);return this},close:function(){this.popselect.hide();this.button.removeClass(this.options.cssSelecting);this.input.removeClass(this.options.cssSelecting);this.popselect.removeClass(this.options.cssSelecting);this._trigger("undrop",null,null);this.isShow=!1;b.ui.dropselect.currentOpen==this.element[0]&&(b.ui.dropselect.currentOpen=this.element[0])},iebgiframe:function(a){var d=/MSIE 6.0/ig.test(navigator.appVersion),
c=/MSIE 7.0/ig.test(navigator.appVersion),f=/MSIE 8.0/ig.test(navigator.appVersion);if(b.browser.msie&&(d||c||f)){var a=b.extend({top:"auto",left:"auto",width:"auto",height:"auto",opacity:!0,src:"javascript:false;"},a||{}),d=function(a){return a&&a.constructor==Number?a+"px":a},e='<iframe class="bgiframe"frameborder="0"tabindex="-1"src="'+a.src+'"style="display:block;position:absolute;z-index:-1;'+(!1!==a.opacity?"filter:Alpha(Opacity='0');":"")+"top:"+("auto"==a.top?"expression(((parseInt(this.parentNode&&this.parentNode.currentStyle&&this.parentNode.currentStyle.borderTopWidth)||0)*-1)+'px')":
d(a.top))+";left:"+("auto"==a.left?"expression(((parseInt(this.parentNode&&this.parentNode.currentStyle&&this.parentNode.currentStyle.borderLeftWidth)||0)*-1)+'px')":d(a.left))+";width:"+("auto"==a.width?"expression(this.parentNode.offsetWidth+'px')":d(a.width))+";height:"+("auto"==a.height?"expression(this.parentNode.offsetHeight+'px')":d(a.height))+';"/>';this.popselect.each(function(){0==b("> iframe.bgiframe",this).length&&this.insertBefore(document.createElement(e),this.firstChild)})}},destroy:function(){b.Widget.prototype.destroy.call(this);
this.element.removeClass("pa_ui_dropselect_dropped").show();this.input.remove();this.button.remove();this.popselect.remove();this.dropselect.remove()}})})(jQuery);
(function(f){f.widget("ui.datepicker",{options:{defaultDate:"+d",dateFormat:"yyyy-mm-dd",minDate:null,maxDate:null,number:1,yearpos:13,enable:!0,onSelect:function(){},onShow:function(){}},_create:function(){var a=this.element,b=f('<span class="datepicker-button" id="'+ +new Date+'" />');a.after(b);this._button=b},_init:function(){this._initialize(this._parseDate(this.options.defaultDate)||new Date)},_initialize:function(a){var b=this,c=b.element,d=b.options,e=f("body"),a=b._resetDefaultDate(a),g=
a.getFullYear(),m=a.getMonth(),h=a.getDate(),i=d.number||1,j=f('<div class="datepicker-warpper fn-clear" />');b._state={};b._state.selectedDate=a;for(a=0;a<i;a++){var k=new Date(g,m+a,h);j.append(b._createPanel(k.getFullYear(),k.getMonth(),k.getDate(),0<a?!1:!0))}j.css({width:f.support.boxModel?200*i+"px":200*i+4+"px"});e.append(j);b._widget=j;c.val(b._formatDate(b._state.selectedDate,d.dateFormat));c.add(b._button).bind("click",function(a){var e=b.options,g=e.onShow,d=b._formatDate(b._state.selectedDate,
e.dateFormat);b._widget?e.enable?(f.isFunction(g)&&g.call(d,c,b._widget),b._widget.show(),b._widget.position({of:c,my:"left top",at:"left bottom",collision:"flip none"})):a.preventDefault():a.preventDefault()});b._binds()},_binds:function(){var a=this,b=a.options,c=a.element,d=a._widget;d.on("click",".datepicker-arrow",function(b){var b=f(b.target),c=b.hasClass("datepicker-arrow-year")?"year":"month",d=b.closest(".datepicker-ymbar"),h=d.find(".datepicker-year-input input").val(),i=d.find(".datepicker-month-input input").val(),
j=b.closest(".datepicker-panel"),k=b.closest(".datepicker-warpper");k.find(".datepicker-year-panel, .datepicker-month-panel").hide();b.hasClass("datepicker-arrow-up")?k.find(".datepicker-arrow").removeClass("datepicker-arrow-up").addClass("datepicker-arrow-down"):(k.find(".datepicker-arrow").removeClass("datepicker-arrow-up").addClass("datepicker-arrow-down"),b.removeClass("datepicker-arrow-down").addClass("datepicker-arrow-up"),"year"==c?(d.find(".datepicker-year-panel").remove(),f(a._createYearPanel(h,
d)).appendTo(d).show()):(d.find(".datepicker-month-panel").remove(),f(a._createMonthPanel(i,j)).appendTo(d).show()))});f(document).bind("click",function(b){b=f(b.target);!b.closest(".datepicker-warpper").is(d)&&!b.is(a._button)&&!b.is(c)&&d.hide()});d.on("click",".datepicker-year-close-control",function(){f(this).closest(".datepicker-year-panel").hide().end().closest(".datepicker-ymbar").find(".datepicker-arrow").removeClass("datepicker-arrow-up").addClass("datepicker-arrow-down")});d.on("click",
".datepicker-year",function(){var b=f(this),c=b.text(),d=b.closest(".datepicker-year-panel"),h=b.closest(".datepicker-ymbar"),i=h.find(".datepicker-month-input input").val(),j=b.closest(".datepicker-warpper");if(1<a.options.number)return a._updatePanel(new Date(c,0,1)),!1;b.hasClass("datepicker-year-disable")||(h.find(".datepicker-year-input input").val(c),b.closest(".datepicker-panel").find(".datepicker-date-panel").replaceWith(a._createDatePanel(c,i-1)),d.hide(),j.find(".datepicker-arrow").removeClass("datepicker-arrow-up").addClass("datepicker-arrow-down"))});
d.on("click",".datepicker-year-left-control",function(c){var d=f(this).closest(".datepicker-ymbar"),m=d.find(".datepicker-year-panel").find("ul:first").find("li:first");a._parseDate(a.options.minDate);var h=+m.text()-(16-b.yearpos+1);m.hasClass("datepicker-year-disable")||(d.find(".datepicker-year-panel").remove(),f(a._createYearPanel(h,d)).appendTo(d).show());c.stopPropagation()});d.on("click",".datepicker-year-right-control",function(c){var d=f(this).closest(".datepicker-ymbar"),m=d.find(".datepicker-year-panel").find("ul:first").find("li:last");
a._parseDate(a.options.maxDate);var h=+m.text()+b.yearpos;m.hasClass("datepicker-year-disable")||(d.find(".datepicker-year-panel").remove(),f(a._createYearPanel(h,d)).appendTo(d).show());c.stopPropagation()});d.on("click",".datepicker-month",function(){var b=f(this),c=b.closest(".datepicker-warpper"),d=b.closest(".datepicker-panel"),h=d.find(".datepicker-year-input input").val(),i=b.text();if(1<a.options.number)return a._updatePanel(new Date(h,i-1,1)),!1;b.is(".datepicker-month-disable")||(d.find(".datepicker-month-input input").val(i),
d.find(".datepicker-date-panel").replaceWith(a._createDatePanel(h,+i-1)),d.find(".datepicker-month-panel").hide(),c.find(".datepicker-arrow").removeClass("datepicker-arrow-up").addClass("datepicker-arrow-down"))});d.on("click",".datepicker-month-close-control",function(){f(this).closest(".datepicker-month-panel").hide().end().closest(".datepicker-ymbar").find(".datepicker-arrow").removeClass("datepicker-arrow-up").addClass("datepicker-arrow-down")});d.on("click",".datepicker-date",function(){var d=
f(this),g,m=d.closest(".datepicker-warpper"),h=b.onSelect,i=d.closest(".datepicker-warpper");d.is(".datepicker-date-disable")||(g=d.attr("date"),a._state.selectedDate=a._parseDate(g),m.find(".datepicker-date").removeClass("datepicker-date-active"),d.addClass("datepicker-date-active"),c.val(g),i.hide(),f.isFunction(h)&&h.call(g,c,i))})},_createPanel:function(a,b,c,d){var e=f('<div class="datepicker-panel" />');e.append(this._createYMPanel({year:{value:a,isChange:d},month:{value:b+1,isChange:d}},e)+
this._createWeekPanel()+this._createDatePanel(a,b,c));return e},_createYMPanel:function(a,b){var c=a.year,d=a.month,e=['<div class="datepicker-ymbar"><ul class="datepicker-ymbar-ul fn-clear">'];e.push('<li class="datepicker-year-input fn-left datepicker-year-text"><input type="text" maxlength="4" class="datepicker-yinput" readonly="true" value="'+c.value+'" />年</li>'+(c.isChange?'<li class="fn-left"><span class="datepicker-arrow datepicker-arrow-year datepicker-arrow-down"></span></li>':""));e.push('<li class="datepicker-month-input fn-left datepicker-month-text"><input type="text" readonly="true" class="datepicker-minput" value="'+
d.value+'" maxlength="2" />月</li>'+(d.isChange?'<li class="fn-left"><span class="datepicker-arrow datepicker-arrow-month datepicker-arrow-down"></span></li>':""));e.push("</ul>"+this._createYearPanel(a.year.value)+this._createMonthPanel(a.month.value,b)+"</div>");return e.join("")},_createYearPanel:function(a,b){for(var c=this.options,d=c.yearpos-1,e=['<div class="datepicker-year-panel"><ul class="datepicker-year-ul fn-clear">'],g=this._parseDate(c.minDate),c=this._parseDate(c.maxDate),g=g&&g.getFullYear(),
c=c&&c.getFullYear(),f=b&&b.find(".datepicker-year-input input").val(),a=+a,h=a-d;h<a-d+16;h++){var i=h;e.push('<li class="datepicker-year'+(g&&i<g||c&&i>c?" datepicker-year-disable":i==(f||a)?" datepicker-year-active":"")+'"><a href="javascript: void(0);">'+i+"</a></li>")}e.push("</ul>");e.push('<div class="datepicker-year-control"><ul class="datepicker-year-ul fn-clear"><li class="datepicker-year-left-control"><a href="javascript: void(0);">« </a></li><li class="datepicker-year-close-control">关闭</li><li class="datepicker-year-right-control"><a href="javascript: void(0);"> »</a></li></ul></div>');
e.push("</div>");return e.join("")},_createMonthPanel:function(a,b){for(var c=this.options,d=['<div class="datepicker-month-panel"><ul class="datepicker-month-ul fn-clear">'],e=b.find(".datepicker-year-input input").val(),g=this._parseDate(c.minDate),c=this._parseDate(c.maxDate),g=g&&new Date(g.getFullYear(),g.getMonth(),1),c=c&&new Date(c.getFullYear(),c.getMonth(),1),f=1;13>f;f++){var h=new Date(e,f-1,1);d.push('<li class="datepicker-month'+(g&&h<g||c&&h>c?" datepicker-month-disable":a==f?" datepicker-month-active":
"")+'"><a href="javascript: void(0);">'+f+"</a></li>")}d.push('</ul><div class="datepicker-month-close-control">关闭</div></div>');return d.join("")},_createDatePanel:function(a,b,c){var d=this.options,c=a&&void 0!=b?new Date(a,b,c?c:1):new Date;c.getDate();for(var a=c.getFullYear(),b=c.getMonth(),e=(new Date(a,b,1)).getDay(),g=this._daysInMonth(a,b),f=(new Date(a,b,g)).getDay(),h=new Date(a,b-1,1),i=this._daysInMonth(h.getFullYear(),h.getMonth()),a=new Date(a,b+1,1),b=['<div class="datepicker-date-panel"><ul class="datepicker-date-ul fn-clear">'],
j=this._parseDate(d.minDate),k=this._parseDate(d.maxDate),p=this._state.selectedDate,n=0;n<e;n++){var o=i-e+n+1,l=new Date(h.setDate(o));b.push('<li class="datepicker-date datepicker-date-prev'+(j&&l<j||k&&l>k?" datepicker-date-disable datepicker-date-disable-other":"")+'" date="'+this._formatDate(l,d.dateFormat)+'"><a href="javascript: void(0);">'+o+"</a></li>")}for(e=1;e<=g;e++)l=new Date(c.setDate(e)),b.push('<li class="datepicker-date '+(j&&l<j||k&&l>k?" datepicker-date-disable":+l==+p?" datepicker-date-active":
"")+'" date="'+this._formatDate(l,d.dateFormat)+'"><a href="javascript: void(0);">'+e+"</a></li>");for(n=1;n<=6-f;n++)l=new Date(a.setDate(n)),b.push('<li class="datepicker-date datepicker-date-next'+(j&&l<j||k&&l>k?" datepicker-date-disable datepicker-date-disable-other":"")+'" date="'+this._formatDate(l,d.dateFormat)+'"><a href="javascript: void(0);">'+n+"</a></li>");b.push("</ul></div>");return b.join("")},_createWeekPanel:function(){var a=['<div class="datepicker-weekbar"><ul class="datepicker-weekbar-ul fn-clear">'];
f.each("日,一,二,三,四,五,六".split(","),function(b,c){a.push('<li class="datepicker-week">'+c+"</li>")});a.push("</ul></div>");return a.join("")},_updatePanel:function(a){var b=this.element;this.updating=!0;this.setDate(a);this.updating=!1;this._widget.show();this._widget.position({of:b,my:"left top",at:"left bottom",collision:"flip none"})},_daysInMonth:function(a,b){return 32-(new Date(a,b,32)).getDate()},_parseDate:function(a){if("[object Date]"==Object.prototype.toString.call(a)&&"Invalid Date"!==a.toString()&&
!isNaN(a)||!a)return a;var b=new Date,c=b.getFullYear(),d=b.getMonth(),e=b.getDate(),a=f.trim(a),g=[],g=[],m=/^([+-])([1-9]\d*)?([ymd])$/;if(-1!=a.indexOf("-")&&(g=a.split("-"),3==g.length))return new Date(g[0],g[1]-1,g[2]);if(/[+-][\d]*[ymd]/.test(a)){for(var g=a.split(/ +/),a={y:["+",0],m:["+",0],d:["+",0]},b=0,h=g.length;b<h;b++)m.test(g[b])&&(a[RegExp.$3][0]=RegExp.$1||"+",a[RegExp.$3][1]=+RegExp.$2||0);return new Date(eval(c+a.y[0]+a.y[1]),eval(d+a.m[0]+a.m[1]),eval(e+a.d[0]+a.d[1]))}return b},
_formatDate:function(a,b){var c=a.getFullYear(),d=a.getMonth()+1,e=a.getDate(),c=b.replace("yyyy",c).replace("mm",0<d&&10>d?"0"+d:d).replace("dd",0<e&&10>e?"0"+e:e);-1!=c.indexOf("m")&&(c=c.replace("m",d));-1!=c.indexOf("d")&&(c=c.replace("d",e));return c},_resetDefaultDate:function(a){var b=this.options,c=this._parseDate(b.minDate);(b=this._parseDate(b.maxDate))&&+a>+b&&(a=c?c:b);c&&+a<+c&&(a=c);return a},destroy:function(){this._widget.remove();this._button.remove();delete this._widget;delete this._button;
f.Widget.prototype.destroy.call(this)},enable:function(){this.options.enable=!0},disable:function(){this.options.enable=!1},setDate:function(a){this.options.defaultDate=a;this.refresh()},getDate:function(){return this._state.selectedDate},parse:function(a){return this._parseDate(a)},refresh:function(){var a=this.element,b=this.options;this._parseDate(b.defaultDate);a.datepicker();a.is(":text")&&!this.updating&&a.val(this._formatDate(this._state.selectedDate,b.dateFormat))}})})(jQuery);
(function(d,g){d.widget("ui.validator",{version:"4.0",build:"2012.1107",options:{tipBox:"",triggerEvent:"blur",rules:null,triggerOnEmpty:!1,eventOnEmpty:!1,triggerOnSubmit:!0,cssShow:"pa_ui_validator_onshow",cssFocus:"pa_ui_validator_onfocus",cssCorrect:"pa_ui_validator_oncorrect",cssError:"pa_ui_validator_onerror",cssEmpty:"pa_ui_validator_onempty",cssElEmpty:"pa_ui_element_normal",cssElShow:"pa_ui_element_normal",cssElFocus:"pa_ui_element_focus",cssElCorrect:"pa_ui_element_correct",cssElError:"pa_ui_element_error",
cssPassword:"pa_ui_validator_password",beforeValid:function(){return!0},preDefines:"",endValid:function(){return!0},emptyNoTip:!1},getter:"check showMessage disable enable",_init:function(){var a=this.element;a.is("form")?(this.form=a,this._bulidForm()):this._bulidElement(a)},disable:function(){this.options.disabled||(this.changDiabled=this.options.disabled=!0);this.element.unbind(".validator")},enable:function(){this.changDiabled&&(this.options.disabled=!1);this._init()},_bulidForm:function(){var a=
this,b=a.options;a.options.triggerOnSubmit&&d(a.form).bind("submit.validator",function(){return b.disabled?!0:a._checkForm()?!0:!1})},_checkForm:function(){var a=this,b=a.options,c=d(a._formElements(a.form)),e=!0,f=!0;a.falseEl=[];b.beforeValid&&(f="function"===typeof b.beforeValid?b.beforeValid(a.form):eval(b.beforeValid+"(self.form)"));if(!f)return!1;c.each(function(b,c){a.valiResult=d(c).validator("check");d(c).data("valiResult",a.valiResult);if(!a.valiResult||"pending"==a.valiResult)e=!1,d(c).validator("showMessage"),
a.falseEl.push(c)});f=!0;b.endValid&&(f="function"===typeof b.endValid?b.endValid(a.form,e):eval(b.endValid+"(self.form,isValid)"));if(!f)return!1;a.falseEl[0]&&!d(a.falseEl[0]).is(":hidden,:disabled,select,:radio,:checked")&&a.falseEl[0].focus();return e},_formElements:function(a){return a.find("input,select,file,textarea").filter(function(){return null==d(this).data("validator")?!1:!0}).not(":submit, :reset, :image")},_bulidElement:function(){var a=this.options,b=a.rules;this.form=this.element.parents("form:first");
0<this.form.length&&(this.form=this.form.eq(0));if(b){for(var c in b)this._isSupportType(a[c])||delete a.rules[c];b.required&&(a.triggerOnEmpty=!0)}this._event()},_isSupportType:function(a){var b=this.element,c=b[0].nodeName;if(a)for(a=a.split(",");0<a.length;)return a[0].toUpperCase()==c||a[0].toUpperCase()==b.attr("type").toUpperCase()?!0:!1;else return!0},_event:function(){var a=this,b=a.element,c=a.options,e=" ";if(c.preDefines){var f=a._preDefines[c.preDefines];c.show=f.show;c.focus=f.focus;
c.empty=f.empty;c.error=f.error;c.rules=d.extend({},c.rules,f.rules)}b.is(":text,:password,:file,textarea")?e=c.triggerEvent:b.is(":radio,:checkbox")?e="click":b.is("select")&&(e=c.triggerEvent);e=d.map(e.split(" "),function(a){return a+".validator"}).join(" ");c.cssElFocus&&b.bind("focus.validator",function(){if(!c.disabled){c.focus&&a._setTipState(c.cssFocus,c.focus);a._setElState(c.cssElFocus)}});0>=a.getLength()&&!a.options.eventOnEmpty&&(a._setTipState(c.cssShow,c.show,c.cssParShow),a._setElState(c.cssElShow));
b.bind(e,function(b){if(!c.disabled)if(a.getLength()<=0&&c.show&&!a.options.eventOnEmpty&&!c.emptyNoTip){a._setTipState(c.cssShow,c.show,c.cssParShow);a._setElState(c.cssElShow)}else if(a.getLength()<=0&&c.emptyNoTip)a._setTipState();else if(a.getLength()<=0&&!c.triggerOnEmpty){a._trigger("empty",b,null);a._setTipState(c.cssEmpty,c.empty,c.cssParEmpty);a._setElState(c.cssElEmpty)}else a.check()})},showMessage:function(a){var b=this.element,c=this.options;if(c.tipBox){"undefined"==typeof this.valiResult&&
(this.valiResult=b.data("valiResult"));if(a&&!a.isValid)return this._setTipState(c.cssError,a.errorMsg),this._setElState(c.cssElError),!1;this.valiResult?(this._setTipState(c.cssCorrect,c.correct),this._setElState(c.cssElCorrect)):this.valiResult||("boolean"==typeof this.valiResult||c.rules.required?this.validtype&&(a="",a=this.validtype.errorMessage?this.validtype.errorMessage:this.validtype.error||c.error,this._setTipState(c.cssError,a),this._setElState(c.cssElError)):(this._setTipState(c.cssCorrect,
this.valiResult),this._setElState(c.cssElCorrect)))}},check:function(){var a=this.element,b=this.options,c=b.rules,e=!0;if(a.is("form"))return this._checkForm();if(!b.disabled){var f=!0;if(b.beforeValid)if("function"===typeof b.beforeValid)f=b.beforeValid(a);else window[b.beforeValid](a);if(!f)return!1;this.ajaxReponse&&(b.show=this.ajaxReponse.show,b.focus=this.ajaxReponse.focus,b.empty=this.ajaxReponse.empty,b.error=this.ajaxReponse.error,b.correct=this.ajaxReponse.correct,c=b.rules=d.extend({},
c,this.ajaxReponse.rules));for(var h in c){var f=this[h],g=c[h];this.validtype=g;if(f){if("required"!=h&&""==a.val())return!0;this.valiResult=e=f.call(a[0],g);if(this.ajaxReponse&&"ajax"==h)continue;this.showMessage();if(!e)break}if("pending"===e)break}f=!0;b.endValid&&(f="function"===typeof b.endValid?b.endValid(a,this.valiResult):eval(b.endValid+"(element,self.valiResult)"));return!f?!1:e}},_setTipState:function(a,b){var c=this.options,c=c.cssShow+" "+c.cssFocus+" "+c.cssEmpty+" "+c.cssCorrect+
" "+c.cssError+" ";this.tipBox=d("#"+this.options.tipBox);var e=this.tipBox.children(".pa_ui_valid_tip");0>=e.length&&(e=d("<div></div>").addClass("pa_ui_valid_tip").appendTo(this.tipBox[0]));"undefined"==typeof b||null==b||""===b?e.removeClass(c).empty().hide():e.removeClass(c).addClass(a).html(b).show()},_setElState:function(a){var b=this.options;this.element.removeClass(b.cssElFocus+" "+b.cssElError+" "+b.cssElCorrect+" "+b.cssElEmpty+" "+b.cssElShow).addClass(a)},checkable:function(){return/radio|checkbox/i.test(this.element[0].type)},
destroy:function(){d.Widget.prototype.destroy.apply(this);this.element.unbind(".validator");this.options.tipBox&&d("#"+this.options.tipBox).empty()},required:function(){var a=d.data(this,"validator"),b=!1;switch(this.nodeName.toLowerCase()){case "select":a=d("option:selected",this);b=0<a.length&&("select-multiple"==this.type||0<(d.browser.msie&&(!a[0]||!a[0].attributes.value||!a[0].attributes.value.specified)?a[0].text:a[0].value).length);break;case "input":if(a.checkable()){b=0<a.getLength();break}default:b=
0<d.trim(d(this).val()).length}return b},exFunction:function(a){d.data(this,"validator");var b=d(this),c=!1,c="string"===typeof a.name?eval(a.name+"($element.val(),element)"):a.name(b.val(),this);c!=g?"string"==typeof c?(isValid=!1,a.errorMessage=c):a.errorMessage=isValid=c:a.errorMessage=isValid=c;return isValid},findByName:function(){var a=this.form,b=this.element[0].name;return d(document.getElementsByName(b)).map(function(c,d){return d.form==a[0]&&d.name==b&&d||null})},getLength:function(){var a=
this.element[0];switch(a.nodeName.toLowerCase()){case "select":return d("option:selected",a).length;case "input":if(this.checkable())return this.findByName().filter(":checked").length}value=d(a).val();a=0;if(1<this.options.wordWidth)for(var b=0;b<value.length;b++)19968<=value.charCodeAt(b)&&40869>=value.charCodeAt(b)?a+=this.options.wordWidth:a++;else a=value.length;return a},getValue:function(a,b){a=a||"string";"date"==a?this.isDate(b)&&(b=this.toDate(b)):"number"==a&&this.isNumeric(b)&&(b=Number(b).valueOf());
return b},isDate:function(a){a=a.match(/^(\d{1,4})(-|\/)(\d{1,2})\2(\d{1,2})$/);if(null==a)return!1;var b=new Date(a[1],a[3]-1,a[4]);return b.getFullYear()==a[1]&&b.getMonth()+1==a[3]&&b.getDate()==a[4]},toDate:function(a){if(self.isDate(a)){var a=a.replace(/\-/ig,"/"),b=a.split("/");d.each(b,function(a){b[a]=b[a].replace(/^0+/g,"")});return b[2]&&0<parseInt(b[1])&&13>parseInt(b[1])&&0<parseInt(b[2])&&32>parseInt(b[2])?new Date(parseInt(b[0]),parseInt(b[1])-1,parseInt(b[2])):null}return null},isNumeric:function(a){return/^[0-9]*$/.test(a)},
max:function(a){var b=d.data(this,"validator"),c=b.options.dataType,e=d(this).val(),a=a.value,e=b.getValue(c,e),a=b.getValue(c,a);return e<=a},min:function(a){var b=d.data(this,"validator"),c=b.options.dataType,e=d(this).val(),a=a.value,e=b.getValue(c,e),a=b.getValue(c,a);return e>=a},minLen:function(a){var b=d.data(this,"validator"),a=a.value;val=b.getLength();a=b.getValue("number",a);return val>=a},maxLen:function(a){var b=d.data(this,"validator"),a=a.value;val=b.getLength();a=b.getValue("number",
a);return val<=a},regex:function(a){d.data(this,"validator");var b=a.value;if(a.trim==g||"0"==a.trim)return RegExp(b).test(d(this).val().replace(/\s/ig,""));if("1"==a.trim)return RegExp(b).test(d.trim(d(this).val()));if("2"==a.trim)return RegExp(b).test(d(this).val())}})})(jQuery);
